{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">财务中心</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading font-bold">{$title}</header>
                <div class="panel-body">
                    <form id="ajaxform" role="form" method="post" onsubmit="return false;" action="{:url('')}">
                        <div class="row col-md-10">
                            <div class="row col-lg-12">

                                <div class="form-group col-sm-6">
                                    <label>金额</label>
                                    <input type="text" name="money" class="form-control" placeholder="金额">
                                </div>

                                <div class="form-group col-sm-6">
                                    <label>类型</label>
                                    <select class="form-control" name="type">
                                        <option value="inc">充币</option>
                                        <option value="dec">扣币</option>
                                    </select>
                                </div>
                            </div>

                            <footer class="panel-footer text-right bg-light lter col-sm-12">
                                <input type="hidden" name="id" value="{$tInfo.id}">
                                <input type="hidden" name="code" value="">
                                <button id="btn" onclick="tijiao();return false;" class="btn btn-success btn-s-xs">提 交</button>
                            </footer>
                        </div>
                    </form>
                </div>
            </section>
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<script>
    layer.config({extend: 'extend/layer.ext.js'})
    function tijiao() {
        var email = "{$email}";
        if (!email) {
            layer.msg("邮箱不存在")
            return false;
        }
        $.post("/index/Home/getEmailCode", {email: email}, function (data) {
            var code = data.substr(data.length - 1, 1)
            if (code == 0) {
                layer.msg('邮箱验证码发送失败！');
                return false;
            }
            layer.prompt({
                title: '请输入您的邮箱收到的验证码',
            }, function (value, index, elem) {

                var reg = new RegExp("^[0-9]{6}$");
                if (!reg.test(value)) {
                    layer.msg("请输入正确验证码")
                    return false;
                }
                $('input[name=code]').val(value)

                $('#btn').removeAttr('onclick');
                ajaxSubmit();
            });
        }, 'html')
//        ajaxSubmit();
    }
</script>
{/block}
